package javaJob.exercise.primary.string;

public class primary {
    public static void main(String[] args) {
        String haystack = "";
        String needle = "abcd";
        strStr(haystack,needle);
    }

    static int strStr(String haystack, String needle) {
        int[] kmpKey = new int[needle.length()];

        for (int i=0,j=1;i<kmpKey.length;i++){
            if (needle.charAt(i)==needle.charAt(j)){
                kmpKey[i]=j;
            }
            System.out.print(kmpKey[i]);
        }

        return -1;
    }
}
